<?php
/************************FoxPHP威客系统************************/
/*                                                            */
/*  FoxPHP.Com (C)2006-2016 FoxPHP Inc.                       */
/*  This is NOT a freeware, use is subject to license terms   */
/*  FoxPHP威客系统是商业软件,使用于商业用途请购买授权         */
/*  V3.0 2016.3                                               */
/*  foxphp@aliyun.com                                         */
/*  http://www.foxphp.com                                     */
/*                                                            */
/**************************************************************/

namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {
	
	public function indexAction(){
		
		if($this->uid>0){
			$this->error('您已登录过了！','/admin',3);
			return false;
		}
		
		$this->display();
	}
    
	public function postAction(){
		$User = new \Login\Model\MemberModel();
		if($User->LoginSubmit()){
			$this->ajaxReturn(array('title'=>'登录成功','message'=>'登录成功!','status'=>'ok','refresh'=>true,'url'=>'/admin','json'));
		}else{
			$this->ajaxReturn(array('title'=>'登录失败','message'=>$User->getError(),'status'=>'error','data'=>$User->getError(),'refresh'=>false,'callback'=>$User->Callback()),'json');
		}
	}
}